import React from 'react';

export default class Watch extends React.Component {

  // 没有watch

  // readonly
  state = {
    count: 0,
  };

  onAdd () {
    this.setState({
      count: this.state.count + 1,
    });
    this.sayHello();
  }

  sayHello () {
    console.log('hello');
  }

  // 渲染
  render () {
    // jsx语法
    return (
      <div>
        { this.state.count }<br/>
        <button onClick={ this.onAdd.bind(this) }>+1</button>
      </div>
    );
  }

}
